
package tractorlk.drops;

import java.util.Collections;
import java.util.List;
import java.util.ArrayList;


public class Deck
{
    List<Card> contents = new ArrayList<Card>();

    public Deck()
    {
        for(int i=0;i<108;i++)
            contents.add(new Card(i));
    }
    public Deck(int num)
    {
        if(num == 1)
        {
                //Hand 1
               contents.add(new Card(0));
               contents.add(new Card(0));
               contents.add(new Card(52));
               contents.add(new Card(52));
               contents.add(new Card(53));
               contents.add(new Card(53));
               contents.add(new Card(13));
               contents.add(new Card(13));
               contents.add(new Card(12));
               contents.add(new Card(12));
               contents.add(new Card(11));
               contents.add(new Card(11));
               contents.add(new Card(10));
               contents.add(new Card(10));
               contents.add(new Card(32));
               contents.add(new Card(43));
               contents.add(new Card(64));
               contents.add(new Card(24));
               contents.add(new Card(63));
               contents.add(new Card(44));
               contents.add(new Card(44));
               contents.add(new Card(23));
               contents.add(new Card(71));
               contents.add(new Card(90));
               contents.add(new Card(4));
                //Hand 2
               contents.add(new Card(3));
               contents.add(new Card(6));
               contents.add(new Card(71));
               contents.add(new Card(25));
               contents.add(new Card(45));
               contents.add(new Card(21));
               contents.add(new Card(34));
               contents.add(new Card(66));
               contents.add(new Card(77));
               contents.add(new Card(88));
               contents.add(new Card(99));
               contents.add(new Card(11));
               contents.add(new Card(22));
               contents.add(new Card(33));
               contents.add(new Card(44));
               contents.add(new Card(55));
               contents.add(new Card(21));
               contents.add(new Card(31));
               contents.add(new Card(41));
               contents.add(new Card(51));
               contents.add(new Card(61));
               contents.add(new Card(71));
               contents.add(new Card(81));
               contents.add(new Card(91));
               contents.add(new Card(101));
                //Hand 3
               contents.add(new Card(22));
               contents.add(new Card(32));
               contents.add(new Card(12));
               contents.add(new Card(42));
               contents.add(new Card(52));
               contents.add(new Card(62));
               contents.add(new Card(72));
               contents.add(new Card(82));
               contents.add(new Card(92));
               contents.add(new Card(102));
               contents.add(new Card(54));
               contents.add(new Card(53));
               contents.add(new Card(54));
               contents.add(new Card(52));
               contents.add(new Card(51));
               contents.add(new Card(70));
               contents.add(new Card(69));
               contents.add(new Card(68));
               contents.add(new Card(23));
               contents.add(new Card(43));
               contents.add(new Card(1));
               contents.add(new Card(2));
               contents.add(new Card(3));
               contents.add(new Card(4));
               contents.add(new Card(9));
                //Hand 4
               contents.add(new Card(7));
               contents.add(new Card(8));
               contents.add(new Card(9));
               contents.add(new Card(41));
               contents.add(new Card(14));
               contents.add(new Card(34));
               contents.add(new Card(43));
               contents.add(new Card(35));
               contents.add(new Card(53));
               contents.add(new Card(36));
               contents.add(new Card(73));
               contents.add(new Card(86));
               contents.add(new Card(68));
               contents.add(new Card(96));
               contents.add(new Card(106));
               contents.add(new Card(107));
               contents.add(new Card(16));
               contents.add(new Card(63));
               contents.add(new Card(82));
               contents.add(new Card(15));
               contents.add(new Card(11));
               contents.add(new Card(7));
               contents.add(new Card(5));
               contents.add(new Card(1));
               contents.add(new Card(0));
               //kitty
               contents.add(new Card(0));
               contents.add(new Card(0));
               contents.add(new Card(52));
               contents.add(new Card(52));
               contents.add(new Card(53));
               contents.add(new Card(53));
               contents.add(new Card(13));
               contents.add(new Card(13));

        }
    }

    public void shuffle()
    {
        Collections.shuffle(contents);
    }

    public List<Card> deal(int handnum)
    {
        List<Card> hand = contents.subList((handnum-1)*25, handnum*25);
        List<Card> newHand = new ArrayList<Card>();
        for(Card s : hand)
        {
            newHand.add(new Card(s));
        }
        return newHand;
    }

    public Card dealSingle(Hand hand, int index)
    {
        Card card = new Card(contents.get(index));
        hand.add2(card);
        return card;
    }

    public List<Card> seperateKitty()
    {
        List<Card> hand = contents.subList(100, 108);
        List<Card> newHand = new ArrayList<Card>();
        for(Card c : hand)
            newHand.add(new Card(c));
        return newHand;
    }
}
